package cn.wolfcode.shop.cloud.msg;

import cn.wolfcode.shop.cloud.common.CodeMsg;

import java.text.MessageFormat;

public class MemberCodeMsg extends CodeMsg {

    public MemberCodeMsg(Integer code, String msg) {
        super(code, msg);
    }

    public MemberCodeMsg() {
    }
    public static final MemberCodeMsg USERNAME_AND_PASSWORD_NOT_NULL= new MemberCodeMsg(50001,"用户名密码不能为空");
    public static final MemberCodeMsg USER_NOT_EXISTS= new MemberCodeMsg(50002,"用户名不正确");
    public static final MemberCodeMsg PASSWORD_ERROR= new MemberCodeMsg(50003,"账号密码不匹配");
    public static final MemberCodeMsg PARARM_ERROR= new MemberCodeMsg(50004,"参数异常:{0}");


    public MemberCodeMsg filterArg(String ...arg){
        MemberCodeMsg memberCodeMsg = new MemberCodeMsg();
        memberCodeMsg.setCode(this.getCode());
        memberCodeMsg.setMsg(MessageFormat.format(this.getMsg(),arg));
        return memberCodeMsg;
    }
}
